<template>
  <el-calendar>
    <template #date-cell="{ data }">
      <div :class="data.isSelected ? 'is-selected' : ''">
        <div>{{ data.day.split('-').slice(1).join('-') }}</div>
        <div v-if="arr.find(v =>v.day === data.day)"> 
          上午：<el-button type="primary" plain size="small">{{ arr.find(v =>v.day === data.day).amwork}}</el-button>
          下午：<el-button type="primary" plain size="small">{{ arr.find(v =>v.day === data.day).pmwork}}</el-button></div>
      </div>
    </template>
  </el-calendar>
</template>
<script>
import { get } from '@/utils/request'
export default {
  name:"working",
  data() {
    return {
     value: new Date(),
     loginState: sessionStorage.login,
     doctor: {
        docId: sessionStorage.docId
      },
    //  arr:[
    //   {date:'2022-12-02',content:'上午：内科一诊室，下午：内科二诊室'},
    //   {date:'2022-12-17',content:'上午：内科一诊室，下午：内科二诊室'},
    //   {date:'2022-12-25',content:'上午：内科一诊室，下午：内科二诊室'},
    //   {date:'2022-12-29',content:'上午：内科一诊室，下午：内科二诊室'},
    //  ],
     arr: [],
    }
  },
  mounted() {
    get('/getDoctorWorkById/', { docId: this.doctor.docId }).then((res) => {
      this.arr = res.data.data
      console.log(this.message)
    })
  },
}
</script>

<style>
.is-selected {
  color: #1989fa;
}
</style>